package se.sll.itintegration.catalogue.gui.service.view.capacity;

import java.util.ArrayList;
import java.util.List;

import se.sll.service.catalogue.common.Translator;
import se.sll.service.catalogue.common.rest.request.CapacityCreateRequest;

/**
 *
 * @author Christer Palm, Nogui
 */
public class CapacityCreateRequestListTranslator implements Translator<CapacityView, List<CapacityCreateRequest>> {
    private static final CapacityCreateRequestListTranslator INSTANCE = new CapacityCreateRequestListTranslator();

    private CapacityCreateRequestListTranslator() {
    }

    @Override
    public List<CapacityCreateRequest> translate(CapacityView from) {
        return translateTo(from, new ArrayList<CapacityCreateRequest>());
    }
    
    @Override
    public List<CapacityCreateRequest> translateTo(CapacityView from, List<CapacityCreateRequest> to) {
        List<CapacityViewUnit> unitCapacityList = from.getCapacity();
        for (CapacityViewUnit unitCapacity : unitCapacityList) {
            CapacityCreateRequestListUnitTranslator.getInstance().translateTo(unitCapacity, to);
        }
        return to;
    }
    
    public static CapacityCreateRequestListTranslator getInstance() {
        return INSTANCE;
    }
}
